<div class="row">
    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
        <div class="widget am-cf">
            <div class="widget-head am-cf">
                <div class="widget-title am-cf">城市运营商列表</div>
                <!-- 工具栏 -->
                <div class="page_toolbar am-margin-bottom-xs am-cf">
                    <div class="am-form-group">
                        <div class="am-btn-group am-btn-group-xs">
                            <a class="am-btn am-btn-default am-btn-success"
                               href="<?= url('agent.operator/add') ?>">
                                <span class="am-icon-plus"></span> 新增运营商
                            </a>
                        </div>
                    </div>
                </div>
                <div class="am-scrollable-horizontal am-u-sm-12">
                    <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>类型</th>
                            <th>运营商性质</th>
                            <th>名称</th>
                            <th>电话</th>
                            <th>添加时间</th>
                            <th>到期时间</th>
                            <th>上级名称</th>
                            <th>上级类型</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>

                        <?php if (!$list->isEmpty()): foreach ($list as $item): ?>
                            <tr>
                                <td class="am-text-middle">
                                    <p class="item-title">{{$item['agent_id']}}</p>
                                </td>
                                <td class="am-text-middle">
                                    <p class="item-title">
                                        <?php if ($item['type'] == 0)
                                            echo '品牌商';
                                        elseif($item['type'] == 1)
                                            echo '城市运营商';
                                        elseif($item['type'] == 2)
                                            echo '城市合伙人';
                                        else
                                            echo '代言人';
                                        ?>
                                    </p>
                                </td>
                                <td class="am-text-middle">
                                    <p class="item-title">
                                        <?php if ($item['level'] == 1)
                                            echo '个人';
                                        else
                                            echo '企业';
                                        ?>
                                    </p>
                                </td>
                                <td class="am-text-middle">
                                    <p class="item-title">

                                        <?= $item['real_name'] ?>

                                    </p>
                                </td>
                                <td class="am-text-middle">
                                    <p class="item-title"><?= $item['company_tel'] ?></p>
                                </td>

                                <td class="am-text-middle"><?= format_time($item['create_time']) ?></td>
                                <td class="am-text-middle"><?= format_time($item['finish_time']) ?></td>
                                <td class="am-text-middle"><?=  $item['recommend_username']?></td>
                                <td class="am-text-middle"><?php if ($item['recommend_typename'] == 0)
                                        echo '品牌商';
                                    elseif($item['recommend_typename'] == 1){
                                        echo '运营商';
                                    }elseif ($item['recommend_typename'] == 2){
                                        echo "合伙人";
                                    }else{
                                        echo '代言人';
                                    }

                                    ?></td>
                                <td class="am-text-middle">
                                    <div class="tpl-table-black-operation">
                                        <a onclick="getInformation('<?= $item['real_name'] ?>','<?= url('agent.agent/getAgentInfo?agent_id='.$item['agent_id']) ?>','<?= $item['agent_id'] ?>')" class="j-delete tpl-table-black-operation-add"
                                           data-id="<?= $item['agent_id'] ?>">
                                            <i class="am-icon-arrow-right"></i> 查看详情
                                        </a>

                                        <a onclick="updateInformation('<?= url('agent.agent/getAgentInfo?agent_id='.$item['agent_id']) ?>','<?= $item['agent_id'] ?>')" class="j-delete tpl-table-black-operation-del"
                                           data-id="<?= $item['agent_id'] ?>">
                                            <i class="am-icon-arrow-right"></i> 修改账户
                                        </a>
                                    </div>
                                </td>
                            </tr>
                        <?php endforeach; else: ?>
                            <tr>
                                <td colspan="4" class="am-text-center">暂无记录</td>
                            </tr>
                        <?php endif; ?>
                        </tbody>
                    </table>
                </div>
                <div class="am-u-lg-12 am-cf">
                    <div class="am-fr"><?= $list->render() ?> </div>
                    <div class="am-fr pagination-total am-margin-right">
                        <div class="am-vertical-align-middle">总记录：<?= $list->total() ?></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    function getInformation(title,url,agentid){
        //console.log(url)
        $('.j-delete').getinfo(title+"详情",url,'get',agentid);
    }
    function updateInformation(url,agentid){
        //console.log(url)
        $('.j-delete').getinfo('修改信息',url,'edit',agentid);
    }
</script>
